Getting the Best K
Getting the Best K
If the size exceeds k, pop
code:python
from random import shuffle
xs = list(range(100))
shuffle(xs)
K = 3
heapify(queue)
heappush(queue, x)
heappop(queue)
---
This page is auto-translated from /nishio/Best Kの取得. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.